<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<title>新增问卷页面</title>
	    <%@include file="/common/commonCSS.jsp" %>
	    <%@include file="/common/commonJS.jsp" %>
		<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
	</head>
	<body >
		<div class="main-container" id="main-container" style="margin-top: 20px;margin-left: 20px">
			<form action="${webRoot}/questionnaire/designSurvey" id="questionnaireForm">
				<div class="row">
					<div class="form-group col-xs-12 ">
						<label class="col-xs-3 control-label no-padding-right"><i class="red"> * </i>请输入问卷名称:</label>
						<div class="col-xs-9">
							<span class="col-xs-11 block input-icon input-icon-right">
								<input id="topic" name="topic" type="text" datatype="*1-64" class="form-control" value="${questionnaire.name}" required="required"/>
							</span>
						</div>
					</div>
				</div>

				<div class="row" style="margin-left: 40%;padding-bottom: 28px;margin-top: 25px;">
					<button class="layui-btn" type="button" id="submitBtn">保 存</button>
					<%--<a class="layui-btn layui-btn-normal" href="${webRoot}/knowledge/list">返 回</a>--%>
				</div>
			</form>
		</div>
	</body>
	<script>
		//提交
		$("#submitBtn").click(function () {
			var url ="${webRoot}/questionnaire/designSurvey";
            checkFormValid($("#questionnaireForm"),function () {
                $.post(url,$("#questionnaireForm").serialize(),function (result) {
                    if(result.code == '0'){
                        if($("#id").val() == ''){
                            alert(result,function () {
                                location.href='${webRoot}/knowledge/list';
                            },function () {
                                $("#submitBtn").reset();
                            });
                        }else {
                            //更新成功，返回List页面
                            toast(result.msg);
                            location.href='${webRoot}/knowledge/list';
                        }
                    }else {
                        alertMsg(result.msg);
                    }

                });
            });

		});
	</script>
</html>